<!doctype html>
<html>

<head>
  <meta charset="utf-8">
  <title>注册</title>
  <link href="1.css" type="text/css" rel="stylesheet">
</head>
<script>
  function login() {
    window.location.href = "index.html";
  }
  function register() {
    var show = document.getElementById("show");
    var user = document.getElementById("user");
    var pwd = document.getElementById("pwd");
    var pwd2 = document.getElementById("pwd2");
    if (user.value != "" && pwd.value == pwd2.value) {
      show.innerHTML = "注册成功！<br>默认账号 admin 默认密码 admin<br>正在跳转到登录页";
      setTimeout(function () {
        window.location.href = "index.html";
      }, 1000);
    } else {
      show.innerHTML = "账号为空或密码和确认密码不一致！<br>默认账号 admin 默认密码 admin";
      user.value = "admin";
      pwd.value = "admin";
      pwd2.value = "admin";
    }
  }
</script>

<body>
  <h1>注册</h1>
  <form>
    <table align="center">
      <tr>
        <td>用&ensp;户&ensp;名：</td>
        <td><input type="text" id="user" size="16"></td>
      </tr>
      <tr>
        <td>密&ensp;&ensp;&ensp;&ensp;码：</td>
        <td><input type="password" id="pwd" size="16"></td>
      </tr>
      <tr>
        <td>确认密码：</td>
        <td><input type="password" id="pwd2" size="16"></td>
      </tr>
      <tr>
        <td><input type="reset" value="重填" class="i"></td>
        <td>
          <input type="button" value="注册" class="i" onClick="register()">
          <a href="#" style="font-size: 10px;" onClick="login()">返回登录</a>
        </td>
      </tr>
    </table>
  </form>
  <p id="show"></p>
</body>

</html>